package com.mashibing.servicedriveruser.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.mashibing.servicedriveruser.mapper.DriverUserWorkStatusMapper;
import com.mashibing.servicedriveruser.service.DriverUserWorkStatusService;
import org.mashibing.dto.DriverUserWorkStatus;
import org.mashibing.dto.ResponseResult;
import org.springframework.stereotype.Service;
/**
 * @author: $dujunhua
 * @create: 2024/6/28 16:23
 * @description: 
 */
@Service
public class DriverUserWorkStatusServiceImpl extends ServiceImpl<DriverUserWorkStatusMapper, DriverUserWorkStatus> implements DriverUserWorkStatusService {

    @Override
    public ResponseResult changeWorkStatus(Long driverId, Integer workStatus) {
        QueryWrapper<DriverUserWorkStatus> queryWrapper = new QueryWrapper<>();
        queryWrapper.eq("driver_id", driverId);
        DriverUserWorkStatus userWorkStatus = this.baseMapper.selectOne(queryWrapper);
        userWorkStatus.setWorkStatus(workStatus);
        this.baseMapper.updateById(userWorkStatus);
        return ResponseResult.success();
    }
}
